﻿<UserControl x:Class="PhantomMvvmToolkitTester.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:phantomConverter="clr-namespace:PhantomMvvmToolkit.Converter;assembly=PhantomMvvmToolkit"
             xmlns:Control="clr-namespace:PhantomMvvmToolkit.Control;assembly=PhantomMvvmToolkit" mc:Ignorable="d"
    d:DesignHeight="900" d:DesignWidth="800">
    
    <UserControl.Resources>
        <phantomConverter:ToVisibility x:Key="ToVisibility" />
        <phantomConverter:ToOpacity x:Key="ToOpacity" />
        <phantomConverter:ToSolidColorBrush x:Key="ToSolidColorBrush" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="Delay Testing" TextAlignment="Center" Padding="5" />

        <StackPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBlock Text="Testing Commands" />
            <TextBlock Text="{Binding CurrentDelaySetting}" />
        </StackPanel>

        <StackPanel Grid.Row="1" Grid.Column="1">
            <Button Content="Start Delay" Command="{Binding}" CommandParameter="StartDelay" />
            <Button Content="Start Delay (Only Root Object)" Command="{Binding}" CommandParameter="StartDelayOnlyRootObject" />
            <Button Content="End Delay" Command="{Binding}" CommandParameter="EndDelay" />
            <Button Content="Update with Non-UI Thread" Command="{Binding}" CommandParameter="ThreadUpdate" />
        </StackPanel>
        
        <Grid Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" Text="Root Object" />
            <TextBlock Grid.Row="1" HorizontalAlignment="Right" Text="String 1" Margin="5,0" />
            <TextBlock Grid.Row="2" HorizontalAlignment="Right" Text="String 2" Margin="5,0" />

            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding String1, Mode=TwoWay}" TextChanged="TextBoxTextChanged" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding String2, Mode=TwoWay}" TextChanged="TextBoxTextChanged" />
        </Grid>
        
        <Grid Grid.Row="2" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" Text="Root Object" />
            <TextBlock Grid.Row="1" HorizontalAlignment="Right" Text="String 1" Margin="5,0" />
            <TextBlock Grid.Row="2" HorizontalAlignment="Right" Text="String 2" Margin="5,0" />

            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding String1}" />
            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding String2}" />
        </Grid>

        <Grid Grid.Row="3">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" Text="Root.SubNProp Object" />
            <TextBlock Grid.Row="1" HorizontalAlignment="Right" Text="String 1" Margin="5,0" />
            <TextBlock Grid.Row="2" HorizontalAlignment="Right" Text="String 2" Margin="5,0" />

            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SubNProp.String1, Mode=TwoWay}" TextChanged="TextBoxTextChanged" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SubNProp.String2, Mode=TwoWay}" TextChanged="TextBoxTextChanged" />
        </Grid>

        <Grid Grid.Row="3" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" Text="Root.SubNProp Object" />
            <TextBlock Grid.Row="1" HorizontalAlignment="Right" Text="String 1" Margin="5,0" />
            <TextBlock Grid.Row="2" HorizontalAlignment="Right" Text="String 2" Margin="5,0" />

            <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SubNProp.String1}" />
            <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SubNProp.String2}" />
        </Grid>

        <TextBlock Grid.Row="4" Grid.ColumnSpan="2" Text="Visible/Opacity Converter Testing" TextAlignment="Center" Padding="5" />
        
        <Grid Grid.Row="5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="1" HorizontalAlignment="Right" Text="bool Value" />
            <TextBlock Grid.Row="2" HorizontalAlignment="Right" Text="bool? Value" />
            <TextBlock Grid.Row="3" HorizontalAlignment="Right" Text="int Value" />
            <TextBlock Grid.Row="4" HorizontalAlignment="Right" Text="int? Value" />
            <TextBlock Grid.Row="5" HorizontalAlignment="Right" Text="float Value" />
            <TextBlock Grid.Row="6" HorizontalAlignment="Right" Text="float? Value" />
            <TextBlock Grid.Row="7" HorizontalAlignment="Right" Text="double Value" />
            <TextBlock Grid.Row="8" HorizontalAlignment="Right" Text="double? Value" />

            <TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" Text="Value" />
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding BoolValue, Mode=TwoWay}" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding NullBoolValue, Mode=TwoWay}" />
            <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding IntValue, Mode=TwoWay}" />
            <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding NullIntValue, Mode=TwoWay}" />
            <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding FloatValue, Mode=TwoWay}" />
            <TextBox Grid.Row="6" Grid.Column="1" Text="{Binding NullFloatValue, Mode=TwoWay}" />
            <TextBox Grid.Row="7" Grid.Column="1" Text="{Binding DoubleValue, Mode=TwoWay}" />
            <TextBox Grid.Row="8" Grid.Column="1" Text="{Binding NullDoubleValue, Mode=TwoWay}" />
        </Grid>

        <Grid Grid.Row="5" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" Text="Visible" />
            <TextBlock Grid.Row="1" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding BoolValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="2" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullBoolValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="3" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding IntValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="4" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullIntValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="5" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding FloatValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="6" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullFloatValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="7" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding DoubleValue, Converter={StaticResource ToVisibility}}" />
            <TextBlock Grid.Row="8" Grid.Column="0" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullDoubleValue, Converter={StaticResource ToVisibility}}" />

            <TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" Text="Opacity" />
            <TextBlock Grid.Row="1" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding BoolValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="2" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullBoolValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="3" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding IntValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="4" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullIntValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="5" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding FloatValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="6" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullFloatValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="7" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding DoubleValue, Converter={StaticResource ToOpacity}}" />
            <TextBlock Grid.Row="8" Grid.Column="1" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullDoubleValue, Converter={StaticResource ToOpacity}}" />

            <TextBlock Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" Text="Visible Inverse" />
            <TextBlock Grid.Row="1" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding BoolValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="2" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullBoolValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="3" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding IntValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="4" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullIntValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="5" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding FloatValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="6" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullFloatValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="7" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding DoubleValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="8" Grid.Column="2" TextAlignment="Center" VerticalAlignment="Center" Text="Visible" 
                       Visibility="{Binding NullDoubleValue, Converter={StaticResource ToVisibility}, ConverterParameter=Inverse}" />

            <TextBlock Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center" Text="Opacity Inverse" />
            <TextBlock Grid.Row="1" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding BoolValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="2" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullBoolValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="3" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding IntValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="4" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullIntValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="5" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding FloatValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="6" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullFloatValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="7" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding DoubleValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
            <TextBlock Grid.Row="8" Grid.Column="3" TextAlignment="Center" VerticalAlignment="Center" Text="Opacity" 
                       Opacity="{Binding NullDoubleValue, Converter={StaticResource ToOpacity}, ConverterParameter=Inverse}" />
        </Grid>

        <TextBlock Grid.Row="6" Grid.ColumnSpan="2" Text="Solid Color Brush Converter Testing" TextAlignment="Center" Padding="5" />
        
        <Grid Grid.Row="7" Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="1" HorizontalAlignment="Right" Text="bool Value" />
            <TextBlock Grid.Row="2" HorizontalAlignment="Right" Text="int Value" />
            <TextBlock Grid.Row="3" HorizontalAlignment="Right" Text="float Value" />
            <TextBlock Grid.Row="4" HorizontalAlignment="Right" Text="double Value" />
            <TextBlock Grid.Row="5" HorizontalAlignment="Right" Text="HEX3 Value" />
            <TextBlock Grid.Row="6" HorizontalAlignment="Right" Text="HEX4 Value" />
            <TextBlock Grid.Row="7" HorizontalAlignment="Right" Text="RGB Value" />
            <TextBlock Grid.Row="8" HorizontalAlignment="Right" Text="RGBA Value" />

            <TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" Text="Value" />
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding BoolValue, Mode=TwoWay}" />
            <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding IntValue, Mode=TwoWay}" />
            <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FloatValue, Mode=TwoWay}" />
            <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding DoubleValue, Mode=TwoWay}" />
            <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Hex3Value, Mode=TwoWay}" />
            <TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Hex4Value, Mode=TwoWay}" />
            <TextBox Grid.Row="7" Grid.Column="1" Text="{Binding RBGValue, Mode=TwoWay}" />
            <TextBox Grid.Row="8" Grid.Column="1" Text="{Binding RBGAValue, Mode=TwoWay}" />


            <TextBlock Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" Text="Color" />
            <Border Grid.Row="1" Grid.Column="2" Background="{Binding BoolValue, Converter={StaticResource ToSolidColorBrush}}" />
            <Border Grid.Row="2" Grid.Column="2" Background="{Binding IntValue, Converter={StaticResource ToSolidColorBrush}}" />
            <Border Grid.Row="3" Grid.Column="2" Background="{Binding FloatValue, Converter={StaticResource ToSolidColorBrush}}" />
            <Border Grid.Row="4" Grid.Column="2" Background="{Binding DoubleValue, Converter={StaticResource ToSolidColorBrush}}" />
            <Border Grid.Row="5" Grid.Column="2" Background="{Binding Hex3Value, Converter={StaticResource ToSolidColorBrush}, ConverterParameter=HEX3}" />
            <Border Grid.Row="6" Grid.Column="2" Background="{Binding Hex4Value, Converter={StaticResource ToSolidColorBrush}, ConverterParameter=HEX4}" />
            <Border Grid.Row="7" Grid.Column="2" Background="{Binding RBGValue, Converter={StaticResource ToSolidColorBrush}, ConverterParameter=RBG}" />
            <Border Grid.Row="8" Grid.Column="2" Background="{Binding RBGAValue, Converter={StaticResource ToSolidColorBrush}, ConverterParameter=RBGA}" />
        </Grid>

        <Control:Repeater ItemsSource="{Binding RepeaterSource}" Grid.Row="8" HorizontalAlignment="Right" Orientation="Horizontal">
        </Control:Repeater>

        <Control:Repeater ItemsSource="{Binding RepeaterSource}" Grid.Row="8" Grid.Column="1" HorizontalAlignment="Left">
            <Control:Repeater.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding }" />
                        <TextBox Width="50" />
                    </StackPanel>
                </DataTemplate>
            </Control:Repeater.ItemTemplate>
        </Control:Repeater>
    </Grid>
</UserControl>
